<?php
/* @var $this HistClaimController */
/* @var $model HistClaim */


$this->breadcrumbs=array(
	'Hist Claims'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List HistClaim', 'url'=>array('index')),
	array('label'=>'Create HistClaim', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#hist-claim-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Klaim</h1>

<br />

<?php //echo CHtml::link('Pencarian','#',array('class'=>'search-button btn')); ?>
<div class="search-form">
<legend>Pencarian</legend>
<?php $this->renderPartial('_search',array(
	'model'=>$model,

)); 
?>
</div>

<br />
<a href="<?php echo Yii::app()->createUrl('histClaim/create'); ?>" class="btn btn-sm btn-primary">Tambah</a><br /><br />





<?php $this->widget('zii.widgets.grid.CGridView',array(
	'itemsCssClass'=>'table table-hover table-striped table-bordered table-condensed',
	'id'=>'hist-claim-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
	'columns'=>array(
		array(
		'header'=>'Nama Klien',
		'value'=>'MstClient::model()->findByPk("$data->mst_client_id")->name',
		),
		array(
		'header'=>'No Polis',
		'value'=>'$data->policy_no',
		),
		array(
		'header'=>'Tgl Input',
		'value'=>'date("d-m-Y",strtotime($data->createdtime))',
		),
		array(
			'header'=>'Periode Polis',
			'value'=>'$data->getPeriodePolis($data->reg_policy_id,$data->type_reg_policy)',
			),
		array(
			'header'=>'Jumlah Case',
			'value'=>'count(HistClaimAnggota::model()->findAll("id_hist_claim=".$data->id))',
			),
		array(
			'header'=>'Total Klaim',
			'value'=>'number_format($data->hitungTotalKlaim($data->id),"0",",",".")',
			),
		array(
               'class'=>'bootstrap.widgets.TBButtonColumn',
               'template' => '{view}{update}{print}{delete}',
               'buttons' => array(
               				
               				'view' => array(
								'options'=>array(
								'class'=>'btn btn-small view'
								)
                            ),

                            'print' => array(
							'label'=> 'Print',
							'url'=>'Yii::app()->createUrl("histClaim/print",array("id"=>$data->id))',
							'icon'=>'print',
							'options'=>array(
								'class'=>'btn btn-small'
							)
							),	  

               				'update' => array(
								'options'=>array(
								'class'=>'btn btn-small update'
								)
                            ),


                            'delete' => array(
								'options'=>array(
								'class'=>'btn btn-small delete'
								)
                            ),


                          

               ),
            'htmlOptions'=>array('style'=>'width: 200px'),
           )
	),
)); ?>



<div id="myModal" class="modal fade in" style="display: none;" aria-hidden="false">
												<div class="modal-dialog" style="width:800px;">
													<div class="modal-content">
														<div class="modal-header">
															<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
															<h4 class="modal-title">Pilih Client</h4>
														</div>
														<div class="modal-body">
															
															<?php //echo $this->renderPartial('_viewClient', array('model'=>$modelClient, 'modelClientNonHealth'=>$modelClientNonHealth));  // I need $productId to by dynamic related to link 
                ?> 
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
															<button id="btnTest" data-dismiss="modal" class="btn btn-primary" type="button">Pilih</button>
														</div>
													</div><!-- /.modal-content -->
												</div><!-- /.modal-dialog -->
</div>